<style>
.el-tabs--card {
  height: calc(100vh - 140px);
}

.el-tab-pane {
  height: calc(100vh - 140px);
  overflow-y: auto;
}
</style>
<template>
  <div>
    <el-tabs v-model="activeName">
      <el-tab-pane label="运动类别列表" name="categoryList">
        <category-list ref="categoryList"/>
      </el-tab-pane>
      <el-tab-pane label="新增运动类别" name="categoryAddNew">
        <category-add-new ref="categoryAddNew" @changeTab="changeTab"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import categoryList from "@/views/backState/site/category/categoryList.vue";
import categoryAddNew from "@/views/backState/site/category/categoryAddNew.vue";

export default {
  name: "categoryMain",
  components: {
    categoryList,
    categoryAddNew
  },
  data() {
    return {
      activeName: "categoryList"
    }
  },
  methods: {
    changeTab(name) {
      this.activeName = name;
      this.$refs.categoryList.loadCategoryTable();
      this.$refs.categoryAddNew.resetForm();
    }
  }
}
</script>

